<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.js"></script>
    <style>
        .nav {
            margin: 0 auto;
            width: 900px;
        }

        .topLine {
            background-color: red;
            width: 100%;
            height: 10px;
        }

        .song {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            grid-gap: 30px 20px;
            /* background-color: royalblue; */
        }
        .item{
            width: 100%;
        }
        .songImg {
            width: 100%;
            background-color: salmon;
        }

        .songer{
            color: gray;
        }
    </style>
</head>

<body>
    <div class="nav">
        <div class="topLine"></div>
        <div class="song">

        </div>
    </div>
    <script>
        var url = "http://localhost:3000/top/album";
        $.ajax({
            method: "get",
            url,
            success: res => {
                console.log(5);
                res.albums.forEach(item => {
                    var {
                        picUrl,
                        artist,
                        name
                    } = item;
                    var singer = artist.name;
                    var html = `<div class="item">
                                <img class="songImg" src=${picUrl} alt="">
                                <p class="songTitle">${name}</p>
                                <p class="songer">${singer}</p>
                            </div>`
                    $(".song").append(html);
                })
            }
        })
    </script>
</body>

</html>